<template>
  <div class="supplier-step-container">
    <step
      :order-status="process"
      :mode="2"
      :step-list="stepList"
      :is-show-correct="false"
      :disable-items="disableItems"
    />
  </div>
</template>

<script>
import Step from '@/components/CreateOrder/orderDetail/step';
export default {
  components: { Step },
  props: {
    process: {
      type: Number,
      default: 0
    },
    detailData: {
      type: Object,
      default: () => {
        return {};
      }
    }
  },
  data() {
    return {
      stepList: [
        { name: '选择账号', id: 0 },
        { name: '确认信息', id: 1 },
        { name: '上刊审批', id: 2 },
        { name: '流程结束', id: 4 }
      ]
    };
  },
  computed: {
    finishStatus() {
      return this.getProcessDetail(4);
    },
    disableItems() {
      if (this.finishStatus.status === 2) {
        return [3];
      }
      return [];
    }
  },
  methods: {
    getProcessDetail(process) {
      if (this.detailData.processDetail) {
        const result = this.detailData.processDetail.find(i => {
          return i.process === process;
        });
        return result || {};
      }
      return {};
    }
  }
};
</script>
